package com.idstaa;

import com.idstaa.bean.ConsumerComponent;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.context.annotation.*;

import java.io.IOException;

public class AnnotationConsumerMain {
    public static void main(String[] args) throws IOException, InterruptedException {
            AnnotationConfigApplicationContext context = new
                    AnnotationConfigApplicationContext(ConsumerConfiguration.class);
            context.start();
            ConsumerComponent service =
                    context.getBean(ConsumerComponent.class);
            while (true) {
                System.in.read();
                try {
                    String hello = service.sayHello("world");
                    System.out.println("result :" + hello);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        @Configuration
        @PropertySource("classpath:/dubbo-consumer.properties")
        @ComponentScan(basePackages = "com.idstaa.bean")
        @EnableDubbo
        static class ConsumerConfiguration {
        }
}
